package auctionsimulation.agent;

import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
import java.util.Properties;

import auctionsimulation.helper.AuctionHelper;

public abstract class Agent implements Runnable, Serializable {

	private static final long serialVersionUID = 7833239506877053130L;

	protected String configFilePath;
	protected Properties behavierProperties;

	public Agent(String configFileName) {
		behavierProperties = new Properties();
		this.configFilePath = "/auctionsimulation/resources/" + configFileName
				+ ".properties";
		InputStream propertiesInputStream = this.getClass()
				.getResourceAsStream(this.configFilePath);
		try {
			try {
				this.behavierProperties.load(propertiesInputStream);
			} catch (NullPointerException e) {
				throw new IOException();
			}
		} catch (IOException e) {
			AuctionHelper.error("could not find configfile "
					+ this.configFilePath, this, e);
		}
	}
}
